import * as actionType from '@/store/action/actionType'
const counterReducer = (state = { count: 0 }, action) => {
    //通过action对象中type值来决定到底执行什么样的操作，或者程序流程
    switch (action.type) {
        case actionType.ADD:
           return {count:state.count+action.payload}
        case actionType.SUB:
            return {count:state.count-action.payload}
        case actionType.MUL:
            return {count:state.count*action.payload}
        case actionType.DIV:
            return {count:state.count/action.payload}
        default:
            return state
    }
}
export default counterReducer